import {upload_file} from './upload.js'
const install = (Vue, vm) => {
	let config = async (params={}) => await vm.$u.get('/addons/keesuishoupai/api.common/init', params)
	//验证码
	let captcha = async (params={}) => await vm.$u.get('/addons/keesuishoupai/api.common/captcha', params)
	let getUserInfo = async (params={}) => await vm.$u.get('/addons/keesuishoupai/api.user/getUserInfo', params)
	
	//获取首页页面数据
		let navList = async (params={}) => await vm.$u.post('/api/suishoupai/nav_list', params)
	//获取页面数据
		let getPageData = async (params={}) => await vm.$u.get('/addons/keesuishoupai/api.common/getPageData', params)
		//获取页面数据
			let cateList = async (params={}) => await vm.$u.get('/api/suishoupai/cate_list', params)
	//获取分类
	let getCategoryList = async (params={}) => await vm.$u.get('/addons/keesuishoupai/api.report/getCategoryList', params)
	//公开
	let getReportOpenList = async (params={}) => await vm.$u.get('/addons/keesuishoupai/api.report/getOpenList', params)
	/* 后加的------------------------------------------------------------------------------------------------------------------------------------------- */
	// 首页数据
	let index_data = async (params={}) => await vm.$u.get('/api/suishoupai/index_list', params)
	let news_list = async (params={}) => await vm.$u.get('/api/suishoupai/news_list', params)
	let news_detail = async (params={}) => await vm.$u.get('/api/suishoupai/news_detail', params)
	let wx_qrcode = async (params={}) => await vm.$u.get('/api/suishoupai/wx_qrcode', params)
	let qr_hx = async (params={}) => await vm.$u.get('/api/suishoupai/qr_hx', params)
	let zhx = async (params={}) => await vm.$u.get('/api/suishoupai/zhx', params)
	/* 后加的------------------------------------------------------------------------------------------------------------------------------------------- */
	//上报详情
	let getReportDetail = async (params={}) => await vm.$u.get('/addons/keesuishoupai/api.report/getDetail', params)
	//我的上报
	let getReportMyList = async (params={}) => await vm.$u.get('/addons/keesuishoupai/api.report/getMyList', params)
	//上报
	let submitReport = async (params={}) => await vm.$u.post('/addons/keesuishoupai/api.report/submit', params)	

	//商品列表
	let getScoreshopGoodList = async (params={}) => await vm.$u.get('/addons/keesuishoupai/api.scoreshop/getGoodList', params)
	//商品详情
	let getScoreshopGoodDetail = async (params={}) => await vm.$u.get('/addons/keesuishoupai/api.scoreshop/getGoodDetail', params)
	//兑换记录
	let getScoreshopOrderList = async (params={}) => await vm.$u.get('/addons/keesuishoupai/api.scoreshop/getOrderList', params)
	//兑换详情
	let getScoreshopOrderDetail = async (params={}) => await vm.$u.get('/addons/keesuishoupai/api.scoreshop/getOrderDetail', params)
	//积分明细
	let getScorelogList = async (params={}) => await vm.$u.get('/addons/keesuishoupai/api.user/getScorelogList', params)
	//兑换操作
	let doExchange = async (params={}) => await vm.$u.post('/addons/keesuishoupai/api.scoreshop/doExchange', params)
	//门店列表
	let shopList = async (params={}) => await vm.$u.post('/api/suishoupai/shop_list', params)

	//登出
	let logout = async (params = {}) => await vm.$u.get('/addons/keesuishoupai/api.user/logout', params)
	//微信小程序登录
	let wxQuickLogin = async (params = {}) => await vm.$u.post('/addons/keesuishoupai/api.login/wxQuickLogin', params)
	//更新头像
	let updateAvatar = async (params = {}) => await vm.$u.post('/addons/keesuishoupai/api.user/avatar', params)
	//更新用户基本信息
	let updateProfile = async (params = {}) => await vm.$u.post('/addons/keesuishoupai/api.user/saveProfile', params)
	//更新用户手机号
	let bindPhone = async (params = {}) => await vm.$u.post('/api/user/bind_phone', params)
	let upload = async (params = {}) => await upload_file(vm, params);
	
	vm.$u.api = {
		config, 
		captcha,
		getUserInfo,
		getPageData,
		cateList,
		navList,
		getCategoryList,
		getReportOpenList,
		index_data,
		getReportDetail,
		getReportMyList,
		submitReport,
		logout,
		wxQuickLogin,
		updateAvatar,
		updateProfile,
		bindPhone,
		getScoreshopGoodList,
		getScoreshopGoodDetail,
		getScoreshopOrderList,
		getScoreshopOrderDetail,
		getScorelogList,
		doExchange,
		shopList,
		upload,
		news_detail,
		news_list,
		wx_qrcode,
		qr_hx,
		zhx,
	};
	
}
export default {
	install
}
